<?php
/**
* Tarpipe Share Widget Habari Plugin
* This plugin allows the blog owner to add the Tarpipe Share Widget on the blog and add a share button to each post, to share your contents among several media types
*
* @author Jose da Silva <jose@josedasilva.net>
* @since 2009-12-03
* 
*/

class TarpipeShare extends Plugin
{
	/**
	* Required plugin information
	* @return array The array of information
	*/
	function info()
	{
		return array(
			'name'		=>	'TarpipeShare Plugin',
			'version'	=>	'0.7',
			'url'		=>	'http://www.josedasilva.net/downloads/habari/plugins/',
			'author'	=>	'Jose da Silva',
			'authorurl'	=>	'http://www.josedasilva.net',
			'licence'	=>	'Apache licence 2.0',
			'description'	=>	'TarpipeShare Plugin'
		);
	}

	/**
	* Add actions to the plugin page for this plugin
	* @param array $actions An array of actions to apply to this plugin
	* @param string $plugin_id The string with the plugin id, generated by the system
	* @return array $actions Array of actions to atach to the specified $plugin_id
	*/
	public function  filter_plugin_config($actions,$plugin_id)
	{
		if( $plugin_id == $this->plugin_id()) {
			$actions[]	=	_t('Configure');
		}
		return $actions;
	}

	/**
	* Method that responds to the user selecting an action on the plugin page
	* @param string $plugin_id String containning the id of the plugin
	* @param string $action The action string suplied via the filter_plugin_config hook
	**/
	public function action_plugin_ui( $plugin_id, $action )
	{
		// Intentionaly left blank
	}

	/**
	* Assigns output code to the template variables
	* @param Theme $theme The theme that will display the template	
	*/
	function theme_show_plugin_tarpipeshare()
	{
		return '';
	}

	public function filter_post_content_out( $content, $post )
	{
		return $content.'<br/><script type="text/javascript" src="http://tarpipe.com/js/widget.js">{title:"'.$post->title.'",url:"'.$post->permalink.'"}</script>';
	}

	public function action_init() {
		// Blank
	}

	/**
	* Returns true if plugin config form values defined in action_plugin_ui whould be stored by habari
	* @return bool True if options should be stored
	*/
	public function updated_config($ui)
	{
		return false;
	}

}
?>
